//
//  pingtairenwuModel.m
//  pacc
//
//  Created by 测试 on 2018/5/28.
//  Copyright © 2018年 测试. All rights reserved.
//

#import "pingtairenwuModel.h"

@implementation pingtairenwuModel
-(void)setValue:(id)value forUndefinedKey:(NSString *)key{
    if([key isEqualToString:@"id"]){
        self.zid = value;
    }
}
- (id)valueForUndefinedKey:(NSString *)key
{
    return nil;
}
- (instancetype)initWithDictionary:(NSDictionary *)dic
{
    self = [super init];
    if (self) {
        [self setValuesForKeysWithDictionary:dic];
    }
    return self;
}
+ (NSMutableArray *)modelSformDics:(NSArray *)arr
{
    NSMutableArray *modelArr = [NSMutableArray array];
    for (NSDictionary *dic in arr) {
        if (dic&&![dic isEqual:[NSNull null]]){
            if ([[dic objectForKey:@"guestOrderId"] intValue] == 0) {
                pingtairenwuModel *model = [[self alloc] initWithDictionary:dic];
                [modelArr addObject:model];
            }
        }
    }
    return modelArr;
}
//字典编辑
+(id)getAUsefulInstanceWith:(NSDictionary *)attributes key:(NSString *)key{
    
    if ([[attributes objectForKey:key]
         isKindOfClass:[NSNumber class]] ||
        [[attributes objectForKey:key] isKindOfClass:[NSString class]] ||
        [[attributes objectForKey:key] isKindOfClass:[NSObject class]] || ![[attributes objectForKey:key] isKindOfClass:[NSNull class]])
    {
        return [NSMutableString stringWithFormat:@"%@", [attributes objectForKey:key]];
    }
    else
    {
        return @"";
        NSLog(@"字段值Id读取异常(字段不存在或者值为空)");
    }
}
@end
